<template>
	<div>
		<textarea v-model="msg"></textarea>
		<mt-button type="primary" size="large" @click="getCom">发表评论</mt-button>
		<h4 v-for="item in list" :key="item">{{item}}</h4>
		<mt-button type="danger" size="large" plain>加载更多</mt-button>
	</div>
</template>

<script>
	export default {
		data() {
			return {
				list:null,
				msg: null
			}
		},
		created(){
			this.$http.get('cm').then(res=>{
				this.list=JSON.parse(res.body).data
				console.log(this.list)
			})
		},
		methods: {
			getCom() {
				this.$http.post('', {"data":this.msg,"time":Date.now()},{emulateJSON:true})
					.then(function(res) {
						console.log(res.body)
						this.list.unshift(res.body.data)
						this.msg=null
					})
			}
		}
	}
</script>

<style>
</style>
